import ownerModel from '../common/ownerModel';
import pagesModel from '../common/pagesModel';

export default class watchlaterItemModel {
  aid: string;
  videos: number;
  tname: string;
  pic: string;
  title: string;
  desc: string;
  dynamic: string;
  cid: number;
  add_at: number;
  progress: number;
  duration: number;
  owner: ownerModel;
  pages: Array<pagesModel>;

  get display(): string {
    return `${this.videos}P ${new Date(this.duration).getMinutes()}`
  }

  get state(): string {
    let ts = new Date();
    ts.setSeconds(this.progress);
    return this.progress == -1 ? '已看完' :
      (this.progress != 0 ? `看到${ts.getMinutes()}:${ts.getSeconds()}` : '尚未观看')
  }
}